package com.isoft.hospital.service.impl;

import com.isoft.hospital.common.ResponseData;
import com.isoft.hospital.dao.YaopinjiaofeiDao;
import com.isoft.hospital.entity.Yaopinjiaofei;
import com.isoft.hospital.service.YaopinjiaofeiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class YaopinjiaofeiServiceImpl implements YaopinjiaofeiService {
    @Autowired
    private YaopinjiaofeiDao dao;

    @Override
    public ResponseData selectAll() {
        List<Yaopinjiaofei> list = dao.selectAll();
        ResponseData responseData = new ResponseData();
        if (list != null) {
            responseData.setCode(0);
            responseData.setMsg("ok");
            responseData.setData(list);
        } else {
            responseData.setCode(1);
            responseData.setMsg("no");
        }
        return responseData;
    }
    @Override
    public ResponseData queryByDocid(int doc_id) {
        List<Yaopinjiaofei> list=new ArrayList<>();
        list=dao.queryByDocid(doc_id);
        ResponseData rd=new ResponseData();
        if(list!=null){
            rd.setCode(0);
            rd.setMsg("查询成功");
            rd.setData(list);
        }else{
            rd.setCode(1);
            rd.setMsg("查询失败");
        }
        return rd;
    }
}